package api

import (
	adminApi "zimuzu_cvn_web_api/router/api/admin/v1"
	appApi "zimuzu_cvn_web_api/router/api/app/v1"
	callBackApi "zimuzu_cvn_web_api/router/api/callBack/v1"
	webApi "zimuzu_cvn_web_api/router/api/web/v1"

	log "github.com/sirupsen/logrus"
)

type API interface {
	Name() string
	Bind()
}

//web接口
var webApiList = []API{
	webApi.IndexAPI{},
	webApi.DynamicAPI{},
	webApi.AnnouncementAPI{},
	webApi.PassportAPI{},
	webApi.UserAPI{},
	webApi.ValidateAPI{},
	webApi.YqbAPI{},
}

//app接口
var appApiList = []API{
	appApi.TestAPI{},
	appApi.AmountAPI{},
	appApi.YqbAPI{},
	appApi.PassportAPI{},
	appApi.ValidateAPI{},
	appApi.UserAPI{},
	appApi.MiningAPI{},
	appApi.PledgeAPI{},
	appApi.IndexAPI{},
	appApi.InviteAPI{},
	appApi.MessageAPI{},
	appApi.NavigationAPI{},
	appApi.SuperNodeAPI{},
	appApi.ViewAPI{},
	appApi.AgentAPI{},
	appApi.UsdtAPI{},
	appApi.TokenAPI{},
	appApi.FlowsAPI{},
	appApi.YtaAPI{},
}

//admin接口
var adminApiList = []API{
	adminApi.PassportAPI{},
	adminApi.AdminAPI{},
	adminApi.UserAPI{},
	adminApi.StatisticsAPI{},
	adminApi.YtaAPI{},
}

//callBack接口
var callBackApiList = []API{
	callBackApi.GatewayAPI{},
}

func BindAPIs() {
	for i, api := range webApiList {
		log.WithField("id", i).WithField("name", api.Name()).Info("Bind webAPI")
		api.Bind()
	}

	for i, api := range appApiList {
		log.WithField("id", i).WithField("name", api.Name()).Info("Bind appAPI")
		api.Bind()
	}

	for i, api := range adminApiList {
		log.WithField("id", i).WithField("name", api.Name()).Info("Bind adminAPI")
		api.Bind()
	}

	for i, api := range callBackApiList {
		log.WithField("id", i).WithField("name", api.Name()).Info("Bind callBackAPI")
		api.Bind()
	}

}
